#ifndef FILTER_H
#define FILTER_H

#include <SFML/Graphics.hpp>

#include <type_traits>
#include <tuple>

template <typename, typename> 
struct insertType;

template <typename  T, typename ...Args>
struct insertType<T, std::tuple<Args...>>
{
    using type = std::tuple<T, Args...>;
};

template <template<typename, typename> class FilterFunction, typename FunctionParameter, typename...> 
struct filter;

template <template<typename, typename> class FilterFunction, typename FunctionParameter> 
struct filter<FilterFunction, FunctionParameter> 
{ 
	using type = std::tuple<>; 
};

template <template<typename, typename> class FilterFunction, typename FunctionParameter, typename Head, typename ...Tail>
struct filter<FilterFunction, FunctionParameter, Head, Tail...>
{
    using type = typename std::conditional<FilterFunction<FunctionParameter, Head>::value,
										   typename insertType<Head, typename filter<FilterFunction, FunctionParameter, Tail...>::type>,
										   typename filter<FilterFunction, FunctionParameter, Tail...>::type
										   >::type;
};

#endif // FILTER_H
